/*
 * @Author: szx
 * @Date: 2022-05-22 15:26:25
 * @LastEditTime: 2022-05-22 15:37:18
 * @Description:
 * @FilePath: \leetcode\面试题\08\04\04.js
 */
/**
 * @param {number[]} nums
 * @return {number[][]}
 */
 var subsets = function (nums) {
    const res = [];
    const n = nums.length;
    const dfs = (path, index) => {
        res.push(Array.from(path));
        for (let i = index; i < n; i++) {
            path.push(nums[i]);
            dfs(path, i + 1);
            path.pop();
        }
    };
    dfs([], 0);
    return res;
};
